#pragma once
#include "DXAMLCommon.h"

#include "CWeakRef.h"

#include "CWeakRefCreator.h"
#include "CSimpleHash.h"
#include "CReferenceCount.h"
class CWeakRefCreator;

class CDependencyObject;

class CWeakRefManager :
	public CReferenceCount
{
private: 
	CWeakRefManager(CCoreServices * pCore);
	virtual ~CWeakRefManager();
public: 
	static HRESULT Create(CWeakRefManager * * ppWeakRefManager, CCoreServices * pCore);
	void Clear();
	HRESULT GetWeakRef(CDependencyObject * pObject , XUINT32 bCreateIfNotFound, CWeakRef * * ppWeakRef);
	HRESULT NotifyDestruction(CDependencyObject * pObject);
private: 
	CCoreServices * m_pCore;
	const XUINT32 nHashSize;


	CSimpleHash * m_pHashTable;
	CWeakRefCreator * m_pWeakRefCreator;
};

